<?php
namespace app\api\controller\v1;

use app\api\model\Category as CategoryModel;
use app\lib\exception\CategoryException;

class Category
{
	
	public function getAllCategories(){
		// $categories = CategoryModel::with('img')->select();
		// 换种写法
		$categories = CategoryModel::all([],'img');
		if($categories->isEmpty()){
			throw new CategoryException();
		}
		return $categories;
	}
}